home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d939.lha
/
ExtraCmds
/
source_etc.lha
/
src
/
Lower.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
3KB
|
108 lines
/* --------------------------------- -------
* |\ | | | | | |.| | \| |/ /|\ |||||||
* | | | |/ | |\ |/ |/| |\ |/ | ? ---+--- =<
* | | | | | | | | | | | \qqqqqqqqq/
* --------------------------------- ~~~~~~~~~~~~~~~~
* Lower - run a command at a nice, possibly lower, priority.
* Copyright (C) 1992 Torsten Poulin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* The author can be contacted by s-mail at
* Torsten Poulin
* Banebrinken 99, 2, 77
* DK-2400 Copenhagen NV
* DENMARK
*
* Created 16-Jan-92 (37.1)
* $Id: Lower.c,v 37.2 93/02/13 16:01:54 Torsten Rel $
* $Log: Lower.c,v $
* Revision 37.2 93/02/13 16:01:54 Torsten
* Changed version tag etc.
*
*/
#include <exec/types.h>
#include <exec/tasks.h>
#include <exec/libraries.h>
#include <dos/dos.h>
#include <dos/dostags.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include "lower_rev.h"
static LONG MySystemTags(struct DosLibrary *DOSBase,
UBYTE *command, ULONG firsttag, ...);
char const versionID[] = VERSTAG;
char const copyright[] = "$COPYRIGHT:© 1992 Torsten Poulin$";
int entrypoint(void)
{
struct RDArgs *args;
struct DosLibrary *DOSBase;
struct Library *SysBase;
LONG niceval, stack;
LONG arg[3];
LONG rc = RETURN_OK;
SysBase = *(struct Library **) 4L;
if(!(DOSBase = (struct DosLibrary *) OpenLibrary("dos.library", 37L)))
return RETURN_FAIL;
arg[0] = arg[1] = arg[2] = 0L;
if(args = ReadArgs("BY/K/N,STACK/K/N,COMMAND/F/A", arg, NULL))
{
niceval = (FindTask(NULL))->tc_Node.ln_Pri;
if(arg[0])
niceval -= *(LONG *) arg[0];
else
niceval--;
if(niceval < -128L) niceval = -128L;
else if(niceval > 10L) niceval = 10L;
if(arg[1])
stack = (*(LONG *) arg[1]) < 1600L ? 1600L : *(LONG *) arg[1];
else
stack = (Cli())->cli_DefaultStack << 2;
rc = MySystemTags(DOSBase, (UBYTE *) arg[2],
SYS_UserShell, TRUE,
NP_Priority, niceval,
NP_StackSize, stack,
TAG_DONE);
if(rc == -1)
rc = RETURN_ERROR;
FreeArgs(args);
}
else
{
LONG err = IoErr();
PrintFault(err, "Lower");
rc = RETURN_ERROR;
}
CloseLibrary((struct Library *) DOSBase);
return rc;
}
static LONG MySystemTags(struct DosLibrary *DOSBase,
UBYTE *command, ULONG firsttag, ...)
{
return SystemTagList(command, (struct TagItem *) &firsttag);
}